var jwt = require('jsonwebtoken')
var singkey = 'mes_qdhd_mobile_xhykjyxgs'
exports.setToken = (username, userid) => {
    return new Promise((resolve, reject) => {
        const token = jwt.sign({
            name: username,
            _id: username
        },singkey, {expiresIn: '0.01h'});
        resolve(token)
    })
    
}


exports.verToken = token => {
    return new Promise((resolve, reject) => {
        var info = jwt.verify(token.split('')[1], singkey)
        resolve(info);
    })
}


